<!-- header -->

<script type="text/javascript" src="js/updates.js"></script>
<%
	String redirect = (String) request.getAttribute("redirected_from_home");
	if( redirect == null || !redirect.equalsIgnoreCase("true") ) {		
		response.sendRedirect("/writeonproject/home");
	}
	out.print("<script> window.onload=getNewsFeedInit;</script>");
%>

<jsp:include page="header.jsp">
	<jsp:param name="title" value="Home"/>
</jsp:include>
<!-- / header -->
<!-- content -->
	<div class="body5">
		<div class="body6">
			<div class="main">
				<div class="wrapper">
					<figure class="left"><img src="images/letter1.png" alt=""></figure>
					<%
						String user = (String) request.getAttribute("userid");
						if( user!= null ) {
							out.print("<h2>Welcome back, <a href=\"/writeonproject/home?page=profile&userid=" + user + "\">" + user + "</a>!</h2>");
							out.print("<ul>" +
			                    "<li><a href=\"/writeonproject/home?page=profile&userid="+user+"\">View Profile</a></li>" +
			                    "<li><a href=\"/writeonproject/home?page=profile&userid="+user+"\">Past Contributions</a></li>" +
			                    "</ul>");
						} else {
							out.print("<h2>Welcome to <span>Write-on</span>!</h2>" + 
								"As a collaborative writing experience, Write-on! lets anyone join in and contribute to a story in progress. <br> Read great stories, share your lists of favourite stories, join a community of talented writers... The possibilities are endless! " +
								"<br> <a href=\"/writeonproject/home?page=register\">Register</a> for a free account now to Write-on! ");
						}
					%>
				</div>
			</div>
		</div>
	</div>	
	<div class="body7">
		<div class="main">
			<section id="content">
				<div class="wrapper">
					<article>
						<div class="pad1">
							<h2>Newsfeed</h2> 
							<div id="newsfeed"> 
							<table id="newsfeedtable">
							</table>
							</div>
						</div>
					</article>
				</div>
			</section>
		</div>
	</div>
	<!-- / content -->

<!-- footer -->
<jsp:include page="footer.jsp"/>
<!-- / footer -->
